<?php
/**
 * Created by PhpStorm.
 * User: zjw
 * Date: 2018/3/8
 * Time: 下午4:00
 */
use kartik\datetime\DateTimePicker;
use kartik\file\FileInput;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

$couponList = \common\models\Coupon::find()->where(['>','origin_num',0])->all();
$couponArr = [];
if (count($couponList) > 0) {
    foreach ($couponList as $coupon) {
        $couponArr[$coupon->id] = $coupon->name;
    }
}

?>
<div class="article-form">
    <?php $form = ActiveForm::begin(); ?>
    <?= $form->field($model, 'coupon_id')->dropDownList($couponArr) ?>
    <?= $form->field($model, 'num')->textInput() ?>
    <?= $form->field($model, 'min_num')->textInput() ?>
    <?= $form->field($model, 'executeTime')->widget(DateTimePicker::classname(),
        ['options' => ['placeholder' => '执行时间'],
            'pluginOptions' => [
                'autoclose' => true,
                'todayHighlight' => true,
                'format' => 'hh:ii:ss',
                'inline' => true,
            ]
        ])->label("执行时间");
    ?>
    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '创建' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>
    <?php ActiveForm::end(); ?>
</div>